package polymorphism1;

/**
 * User: 86156
 * Date: 2023-04-12
 * Time: 9:01
 */
public class Test {
    public static void main(String[] args) {

        Student s = new Student("zhangsan",18);
        register(s);

        Teacher t = new Teacher("lisi",18);
        register(t);

        Administrator a = new Administrator("wangwu",18);
        register(a);

    }

    // 这个方法既能接受老师,又能接受学生和管理员
    // 函数参数只能是这些的父类 即 Person
    public static void register(Person p){
        p.show();
    }
}
